Skip to content

Feature/viewport grid overlay - #16

Merged
ev-mp merged 1 commit into
devfrom
feature/viewport-grid-overlay
May 25, 2026
Merged

Feature/viewport grid overlay#16
ev-mp merged 1 commit into
devfrom
feature/viewport-grid-overlay

Conversation

@ev-mp

@ev-mp ev-mp commented May 24, 2026

Copy link
Copy Markdown
Owner

No description provided.

@ev-mp
ev-mp force-pushed the feature/viewport-grid-overlay branch 7 times, most recently from f20032c to f19680d Compare May 25, 2026 08:28
Adds an optional 2D viewport grid overlay to the realsense-viewer,
compiled under the BUILD_VIEWPORT_GRID_OVERLAY CMake flag (default OFF).

Feature summary
- Grid lines rendered over each 2D stream viewport using OpenGL
  (glBegin/GL_LINES) with glPushAttrib(GL_CURRENT_BIT) to prevent
  color-state bleed into PiP thumbnails
- Two new toggle buttons in each stream header:
  - Grid icon (fa-th ): show/hide the grid overlay
  - Info icon: show/hide viewport metadata overlay
  Both buttons start OFF at every launch (state is not persisted)
- Per-stream grid config: horizontal lines [1-5], vertical lines [1-5],
  line width (>=1), RGB color [0-255 each]; out-of-range values fall
  back to defaults (not clamped)

Configuration (realsense-config.json)
- Grid settings stored under viewer_model.grid.* using dot-path nested
  JSON API (get_nested / set_nested / set_nested_default)
- Defaults are written only in two cases:
  1. New file: config_file tracks _is_new_file (set in the
     file-based constructor when load_from_file returns nothing);
     ux_window writes defaults on startup when is_new_file() is true
  2. Restore Defaults button: viewer.cpp injects grid defaults into
     temp_cfg immediately after the reset, so they are saved on OK/Apply
- Existing configs without the grid section are left untouched

Files changed
- CMake/lrs_options.cmake: add BUILD_VIEWPORT_GRID_OVERLAY option (OFF)
- common/device-model.h: configurations::viewer::viewport_grid namespace
  with the six JSON key constants
- common/textual-icons.h: textual_icons::grid icon (, fa-th)
- common/rs-config.h / rs-config.cpp: is_new_file() accessor backed by
  _is_new_file member set in the filename constructor
- common/stream-model.h / stream-model.cpp: grid state members, toggle
  buttons, draw_2d_grid() helper; constructor reads grid config from JSON
- common/ux-window.cpp: write grid defaults on new-file startup
- common/viewer.cpp: write grid defaults when Restore Defaults is pressed
- tools/realsense-viewer/CMakeLists.txt: target_compile_definitions for
  BUILD_VIEWPORT_GRID_OVERLAY

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ev-mp
ev-mp force-pushed the feature/viewport-grid-overlay branch from f19680d to 5ef5cb6 Compare May 25, 2026 08:30

@ev-mp ev-mp left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready for production

@ev-mp
ev-mp merged commit 0d98ea6 into dev May 25, 2026
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant